<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="viewport" content="width=device-width,initial-scale=1">
	<meta name="description" content="A fully featured admin theme which can be used to build CRM, CMS, etc.">
	<meta name="author" content="Coderthemes">
	
	<!-- jQuery  -->
    <script type="text/javascript" src="/static/plugins/jquery/jquery-3.6.0.min.js"></script>
	
	<!-- layui  -->
	<link rel="stylesheet" href="/static/plugins/layui/2.5.6/css/layui.css" media="all" />
	<script type="text/javascript" src="/static/plugins/layui/2.5.6/layui.js"></script>

	<!-- bo -->
	<link href="/static/plugins/bo/bo.css" rel="stylesheet" type="text/css">
	<script src="/static/plugins/bo/bo.js"></script>

	<!-- kindeditor -->
	<script type="text/javascript" src="/static/plugins/kindeditor/kindeditor-all.js"></script>
	<script type="text/javascript" src="/static/plugins/kindeditor/lang/zh-CN.js"></script>
</head>

<body>
	<form class="layui-form" id="id_form" method="post" action="/api/inter/newsItem/add">
		<input type="hidden" name="pid" th:value="${dto.pid}">
		<div class="layui-form-item">
			<div class="layui-inline layui-col-xs4 margin_r0">
				<div>
					<label class="layui-form-label">上级菜单：</label>
					<div class="layui-input-block">
						<input type="text" name="pname" th:value="${dto.pname}" class="layui-input layui-disabled" readonly >
					</div>
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">标题</label>
			<div class="layui-input-block">
				<input type="text" name="name" placeholder="请输入标题" class="layui-input" lay-verify="required" autocomplete="off">
			</div>
		</div>
	
		<div class="layui-form-item" pane="">
			<label class="layui-form-label">状态</label>
			<div class="layui-input-block">
				<input type="radio" name="status" th:each="status: ${dto.statusArr}" th:value="${status.value}" th:title="${status.name}" lay-skin="primary" lay-filter="status" th:checked="${status.isSelected()}">
			</div>
		</div>
   		
		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
			<legend>图文详情</legend>
		</fieldset>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<textarea id="editor_id" name="detail"></textarea>
			</div>
			<script>
				KindEditor.ready(function(K) {
					window.editor = $BO.initKindEditorNew('editor_id', '');
				});
			</script>
		</div>

		<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;"></fieldset>
		<div class="layui-form-item">
			<div class="layui-col-md1 layui-col-md-offset11">
				<div class="layui-btn-container">
					<button type="button" class="layui-btn" lay-submit lay-filter="formSubmit">保存</button>
				</div>
			</div>
		</div>
	</form>
	<script>
	$(function () {
		layui.use(['form'], function(){
			var form = layui.form;
			
			// 表单提交，共用同一个
			form.on('submit(formSubmit)', function(data){
				var indexOfLoading = layer.load(1, {
					shade: [0.5,'#000000'] //0.1透明度的白色背景
				});
				$.post(data.form.action, data.field, function(res){
					if (res.code == 0) {
						layer.msg(res.msg);
						window.parent.location.reload();
						var index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);
					} else {
						layer.close(indexOfLoading);
						layer.msg(res.msg);
					}
				});
				return false;
			});
		});
	});
	</script>
</body>
</html>